package com.objecteffects.ilmp.model;

import javax.persistence.Column;
import javax.persistence.Entity;

import org.apache.commons.lang3.builder.ToStringBuilder;

/*
 * Hibernate makes extra tables when using AbstractEntity. Not
 * attractive.
 */
@Entity
public class SubclassedNamedEntity extends AbstractEntity {
    private static final long serialVersionUID = 1L;

    @Column(updatable = false, nullable = false)
    private String name;

    public SubclassedNamedEntity() {
        //
    }

    /**
     * @param _name
     *        the name to set
     */
    public SubclassedNamedEntity(final String _name) {
        this.name = _name;
    }

    /**
     * @return the name
     */
    public final String getName() {
        return this.name;
    }

    /**
     * @param _name
     *        the name to set
     */
    public final void setName(final String _name) {
        this.name = _name;
    }

    @Override
    public final String toString() {
        return new ToStringBuilder(this).append("id", this.getId())
            .append("name", this.name).toString();
    }
}
